package model;

public class User {
	
	private Long key;
	private String firstname;
	private String lastname;
	private String patronymic;
	private String company;
	private String post;
	
	public User() {
		
	}
	
	public User(Long key, String firstname, String lastname, String patronymic, String company, String post) {
		this.key = key;
		this.firstname = firstname;
		this.lastname = lastname;
		this.patronymic = patronymic;
		this.company = company;
		this.post = post;
	}
	
	public Long getKey() {
		return key;
	}
	
	public String getFirstname() {
		return firstname;
	}
	
	public String getLastname() {
		return lastname;
	}
	
	public String getPatronymic() {
		return patronymic;
	}
	
	
	
	public void setKey(Long key) {
		this.key = key;
	}
	
	public void setFirstname(String firstname) {
		this.firstname = firstname;
	}
	
	public void setLastname(String lastname) {
		this.lastname = lastname;
	}
	
	public void setPatronymic(String patronymic) {
		this.patronymic = patronymic;
	}
	
	public String getPost() {
		return post;
	}

	public void setPost(String post) {
		this.post = post;
	}
	
	public String getCompany() {
		return company;
	}

	public void setCompany(String company) {
		this.company = company;
	}	
	
	public String getFullname() {
		return firstname + " " + patronymic + " " + lastname;
	}
	
	@Override
	// This must return true for another User object with same key/id.
    public boolean equals(Object other) {
        return other instanceof User && (key != null) ? key.equals(((User) other).key) : (other == this);
    }

    // This must return the same hashcode for every User object with the same key.
    @Override
    public int hashCode() {
        return key != null ? this.getClass().hashCode() + key.hashCode() : super.hashCode();
    }

    // Override Object#toString() so that it returns a human readable String representation.
    // It is not required by the Converter or so, it just pleases the reading in the logs.
    @Override
    public String toString() {
        return getFullname();
    }



	

}

